package com.itlong.cloud.app.resource;

import com.itlong.cloud.POJO.DTO.app.AppGetParkingListDTO;
import com.itlong.cloud.POJO.VO.app.AppGetParkingDateVO;
import com.itlong.cloud.POJO.VO.app.AppGetParkingListVO;
import com.itlong.cloud.app.service.IAppParkRecordService;
import com.itlong.cloud.user.app.IAppParkRecordServiceClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <desc>
 *      停车记录暴露接口实现类
 * <desc/>
 *
 * @createDate 2018/11/08
 */
@RestController
public class AppParkRecordServiceResource implements IAppParkRecordServiceClient {

    @Autowired
    private IAppParkRecordService iAppParkRecordService;

    /**
     * <desc>
     *      获取用户停车记录列表
     * </desc>
     *
     * @return 用户停车记录列表
     * @author wanghzi
     * @createDate 2018/11/09
     */
    @Override
    @PostMapping(path = "app/parking/getParkingList")
    public AppGetParkingListVO getParkingList(@RequestBody AppGetParkingListDTO appGetParkingListDTO) throws Exception {
        return iAppParkRecordService.getParkingList(appGetParkingListDTO);
    }

    /**
     * <desc>
     *      获取该用户停车记录列表有效查询时间
     * </desc>
     *
     * @return 该用户停车记录列表有效查询时间
     * @author wanghzi
     * @createDate 2018/11/09
     */
    @Override
    @PostMapping(path = "app/parking/getParkingDateList")
    public List<AppGetParkingDateVO> getParkingDateList(@RequestParam("carNum") String carNum,@RequestParam("userId") String userId) throws Exception {
        return iAppParkRecordService.getParkingDateList(carNum,userId);
    }
}
